﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Globalization;
using System.Web.Security;

namespace prufa.Models
{

    [Table("UserProfile")]
    public class UserProfile
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int UserId { get; set; }
        public string UserName { get; set; }

        // Auto-Impl Properties for the additional attributes in UserProfile Table. BLL
        public string Email { get; set; }
        public bool IsBanned { get; set; }
        public bool IsAdmin { get; set; }
        public string Date { get; set; }
        public string Avatar { get; set; }
    }
    public class RegisterExternalLoginModel
    {
        [Required(ErrorMessage = "Sláðu inn notendanafn")]
        [Display(Name = "Notendanafn")]
        public string UserName { get; set; }

        public string ExternalLoginData { get; set; }
    }

    public class LocalPasswordModel
    {
        [Required(ErrorMessage = "Sláðu inn lykilorð")]
        [DataType(DataType.Password)]
        [Display(Name = "Núverandi lykilorð")]
        public string OldPassword { get; set; }

        [Required(ErrorMessage = "Sláðu inn lykilorð")]
        [StringLength(100, ErrorMessage = "{0}ið þarf að vera minnst {2} stafir", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Nýtt lykilorð")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Staðfesta nýtt lykilorð")]
        [Compare("NewPassword", ErrorMessage = "Lykilorðið og staðfesting þess stemma ekki!")]
        public string ConfirmPassword { get; set; }
    }

    public class LoginModel
    {
        [Required(ErrorMessage = "Sláðu inn notendanafn")]
        [Display(Name = "Notendanafn")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "Sláðu inn lykilorð")]
        [DataType(DataType.Password)]
        [Display(Name = "Lykilorð")]
        public string Password { get; set; }

        [Display(Name = "Muna eftir mér?")]
        public bool RememberMe { get; set; }
    }

    public class RegisterModel
    {
        [Required (ErrorMessage = "Sláðu inn notendanafn")]
        [Display(Name = "Notendanafn")]
        public string UserName { get; set; }
        // Email added into the register-model BLL
        [Required(ErrorMessage = "Sláðu inn netfang")]
        [Display(Name = "Netfang")]
        public string Email { get; set; }

        [Required(ErrorMessage = "Sláðu inn lykilorð")]
        [StringLength(100, ErrorMessage = "{0}ið þarf að vera minnst {2} stafir", MinimumLength = 4)]
        [DataType(DataType.Password)]
        [Display(Name = "Lykilorð")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Staðfesta lykilorð")]
        [Compare("Password", ErrorMessage = "Lykilorðið og staðfesting þess stemma ekki!")]
        public string ConfirmPassword { get; set; }
        // IsBanned added into the register-model (Maybe unnecessary) BLL
        public bool IsBanned { get; set; }
        // IsAdmin added into the register-model (Maybe unnecessary) BLL
        public bool IsAdmin { get; set; }
        public string Date { get; set; }
        [Display(Name = "Prófilmynd")]
        [StringLength(100, ErrorMessage = "Slóð á mynd verður að vera a.m.k. 4 stafa löng", MinimumLength = 4)]
        public string Avatar { get; set; }
        
    }

    public class ExternalLogin
    {
        public string Provider { get; set; }
        public string ProviderDisplayName { get; set; }
        public string ProviderUserId { get; set; }
    }
}
